<template>
  <div class="parentWrapper">
    <div class="info">
      <div class="name">{{ commentParent.user.nickname }}</div>
      <div class="date">3小时前</div>
      <div class="btnReply" @click="handleReply">回复</div>
    </div>
    <div class="mainContent">
      {{ commentParent.content }}
      <comment-parent
        v-if="commentParent.parent"
        :commentParent="commentParent.parent"
      />
    </div>
  </div>
</template>

<script>
import eventBus from "../../utils/index";
export default {
  name: "CommentParent",
  props: {
    commentParent: Object,
  },
  data() {
    return {};
  },
  methods: {
    handleReply() {
      eventBus.$emit("clickReply", this.commentParent.id);
    },
  },
};
</script>

<style scoped lang="less">
.parentWrapper {
  border: 1px solid #e4e4e4;
  padding: 4/360 * 100vw;
}
.info {
  display: flex;
  .date {
    flex: 1;
    padding-left: 10/360 * 100vw;
    font-size: 12/360 * 100vw;
    color: #888;
  }
}
.btnReply {
  font-size: 14/360 * 100vw;
  color: #888;
}
.mainContent {
  padding: 10/360 * 100vw 0;
}
</style>
